package com.codeyang.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.codeyang.domain.SysLoginUser;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 描述: 登录
 *
 * @author CodeYang_Site
 * @version 2021/5/22 20:23
 */
@Mapper
public interface SysLoginUserMapper extends BaseMapper<SysLoginUser> {


    /**
     * 根据用户id查询权限列表
     *--已经修改
     * @param userId
     * @return
     */
    @Select("SELECT DISTINCT t1.perms FROM `sys_menu` as t1 join sys_role_menu as t2 join sys_user_role as t3 on(t1.menu_id=t2.menu_id and t2.role_id=t3.role_id ) where t3" +
            ".user_id = #{userId} and t1.perms <>''")
    List<String> findAuthsById(Long userId);
}